<!DOCTYPE html>
<!--
Copyright (C) 2015 Vishal Gupta<ims.vishal@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<html>
    <head>
        <title>Underscore</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <div id="content"></div>
        <script type="text/template" id="temp">
            <% 
                for (var i in data)
                    if (i == 'a' || i == 'c') {
            %>
                <span id="<%=i%>"><%=data[i]%></span>
            <% } %>
        </script>        
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
        <script>
            var template = _.template(document.getElementById('temp').innerHTML);
            var data = {
                a: 1,
                b: 2,
                c: 3
            };

            $('#content').append(template({
                data: data
            }));
        </script>
    </body>
</html>
